package com.Service.impl;

import com.Service.MenuService;
import com.dao.MenuMapper;
import com.model.pojo.Menu;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {
    @Resource
    private MenuMapper menuMapper;
    @Resource
    private  Menu menu;
    @Override
    public List<Menu> menu() {


        return menuMapper.menu();
    }

    @Override
    public List<Menu> menuCopy() {
        return menuMapper.menuCopy();
    }

    @Override
    public List<Menu> menuChild() {
        return menuMapper.menuChild();
    }

    @Override
    public List<Menu> menuChildcopy() {
        return menuMapper.menuChildcopy();
    }


    @Override
    @Transactional
    public boolean modifyReceiving(List<Menu> list) {

        menuMapper.dropa();
        boolean bl=false;
        for(int i=0;i<list.size();i++){
            menu.setMenuNameOne(list.get(i).getMenuNameOne());
            menu.setMenuNametwo(list.get(i).getMenuNametwo());
            menu.setMenuPath(list.get(i).getMenuPath());
            bl=menuMapper.modifyReceiving(menu);
            if(bl==false){
                break;
            }


        }




        return bl;
    }


}
